Skip to content

Add touch event listeners for mobile movement tracking in speed modifier component (again)#20

Merged
MakingSpiderSense merged 3 commits into
mainfrom
bugfix/movement-speed-modifier/118-show-speed-lines-on-mobile
Jun 17, 2026
Merged

Add touch event listeners for mobile movement tracking in speed modifier component (again)#20
MakingSpiderSense merged 3 commits into
mainfrom
bugfix/movement-speed-modifier/118-show-speed-lines-on-mobile

Conversation

@MakingSpiderSense

Copy link
Copy Markdown
Owner

This pull request improves support for mobile touch input to the movement-speed-modifier component. The main changes include tracking touch events, updating movement logic to recognize touch-based movement, and ensuring that speed lines show up when moving forward on mobile.

Mobile touch input support:

  • Added touchCount property and methods (onTouchStart, onTouchEnd) to track the number of fingers on the screen, and update movement state accordingly. [1] [2]
  • Implemented addTouchListeners and removeTouchListeners methods to manage touch event listeners during component lifecycle. [1] [2]

Movement logic updates:

  • Modified the isMovingForward method to support forward movement when one finger is on the screen (two fingers moves the player backwards, so that would register as false), allowing for mobile-friendly movement controls.

Trello: https://trello.com/c/GmhnPkKL

(Resubmitting this PR - see for details)

Copilot AI review requested due to automatic review settings June 17, 2026 19:59
@MakingSpiderSense MakingSpiderSense merged commit 483817e into main Jun 17, 2026
1 check passed
@MakingSpiderSense MakingSpiderSense deleted the bugfix/movement-speed-modifier/118-show-speed-lines-on-mobile branch June 17, 2026 20:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves mobile support for the movement-speed-modifier A-Frame component by tracking touch input and using it as an additional “moving forward” signal so the speed-lines effect can appear while moving on mobile.

Changes:

  • Track active touches via a new touchCount state, updated by touchstart / touchend / touchcancel handlers.
  • Add/remove global touch event listeners during the component lifecycle (init / remove).
  • Update isMovingForward() to treat exactly one touch as forward movement so speed lines can be shown appropriately on mobile.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +271 to +274
onTouchStart: function (event) {
this.touchCount = event.touches.length;
this.syncSpeedLinesVisibility();
},
Comment on lines +283 to +286
onTouchEnd: function (event) {
this.touchCount = event.touches.length;
this.syncSpeedLinesVisibility();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants